package WaiBao;

import java.util.Arrays;

public class HanXIinNi {
    public static void main(String[] args) {
        String[] name = {"温英俊(班长)", "王春艳(团支书)", "小李(学习委员)", "刘琼华(体育委员)", "谢青", "蔡英", "王翠", "龙燕", "杨洋", "王青", "冯艳萍", "高兴",
                "唐忠玲", "吴国辉", "苏国辉", "李志荣", "王忠琼", "田丽", "李海玲", "王可贵", "赵茂清", "雍正", "朱洁", "任伟", "向雪琴", "叶顺华", "宋冬梅", "陈玲霞",
                "刘艳", "韩昕倪 (学生)"};//考生本人: 韩昕倪 (学生)
        int[] Age = {21, 20, 18, 21, 21, 18, 19, 20, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 19};//考生年龄：19岁
        double[] huolong1 = {88, 86, 64, 70, 65, 79, 78, 89, 70, 90, 90, 77, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 95};
        double[] huolong2 = {78, 85, 79, 86, 88, 77, 88, 89, 94, 90, 91, 77, 86, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 95};
        double[] huolong3 = {71, 96, 91, 85, 71, 69, 78, 89, 80, 60, 93, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 96};

        double defen;//代表每个学生的总分
        double getping;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            defen = huolong1[i] + huolong2[i] +huolong3[i];
//            getping = ( defen * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + defen);
//            System.out.println(name[i] + "的平均分为:" +getping);
//        }


        double lehe = 0, chengzi = 0;
        double[] undex = new double[30];
//        for (int i = 0; i < 30; i++) {
//            lehe = huolong1[i] + huolong2[i] + huolong3[i];
//            getping = (lehe * 1.0) / 3;
//            undex[i] = getping;
//        }
//
//        for (int i = 0; i < undex.length - 1; i++) {
//            for (int j = 0; j < undex.length - i - 1; j++) {
//                if (undex[j] < undex[j + 1]) {
//                    double tep = undex[j];
//                    undex[j] = undex[j + 1];
//                    undex[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(undex[i]);
//        }


        double first1 = 0,first2 = 0, first3 = 0;//计算每门课的平均分
        double second1 = 0,second2 = 0, second3 = 0;//计算每门课标准差
        double third1 = 0,third2 = 0, third3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < huolong1.length; i++) {
            sum2+=huolong1[i];
        }
        first1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+first1);
        double Sum = 0;
        for (int i = 0; i < huolong2.length; i++) {
            Sum+=huolong2[i];
        }
        first2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+first2);
        double sum = 0;
        for (int i = 0; i <huolong3.length; i++) {
            sum+=huolong3[i];
        }
        first3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+first3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <huolong1.length; i++) {
            c1+= (huolong1[i] -first1)*(huolong1[i] - first1);
        }
        second1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+second1);

        for (int i = 0; i < huolong2.length; i++) {
            c2+= (huolong2[i] - first2)*(huolong2[i] - first2);
        }
        second2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+second2);

        for (int i = 0; i < huolong3.length; i++) {
            c3+= (huolong3[i] -first3)*(huolong3[i] - first3);
        }
        second3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+second3);
//
//
//        Arrays.sort(huolong1);
//        Arrays.sort(huolong2);
//        Arrays.sort(huolong3);
//        third1 =( huolong1[14]+huolong1[15])*1.0/2;
//        third2 =( huolong2[14]+huolong2[15])*1.0/2;
//        third3 =( huolong3[14]+huolong3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+third1);
//        System.out.println("微生物学的中位数为:"+third2);
//        System.out.println("人体组织解剖学的中位数为:"+third3);
    }
}
